﻿using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
// --- Copyright (c) notice NevoWeb ---
//  Copyright (c) 2008 SARL NevoWeb.  www.nevoweb.com. BSD License.
// Author: D.C.Lee
// ------------------------------------------------------------------------
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// ------------------------------------------------------------------------
// This copyright notice may NOT be removed, obscured or modified without written consent from the author.
// --- End copyright notice --- 



using System.Runtime.Remoting;

namespace NEvoWeb.Modules.NB_Store
{

    public abstract class ChequeInterface
    {

        #region "Shared/Static Methods"

        // singleton reference to the instantiated object 

        private static ChequeInterface objProvider = null;
        // constructor
        static ChequeInterface()
        {
            CreateProvider();
        }

        // dynamically create provider
        private static void CreateProvider()
        {
            ObjectHandle handle = null;
            NB_Store_SettingsInfo objInfo = default(NB_Store_SettingsInfo);
            SettingsController objSCtrl = new SettingsController();
            string[] Prov = null;

            objInfo = objSCtrl.GetSetting(((DotNetNuke.Entities.Portals.PortalSettings)HttpContext.Current.Items("PortalSettings")).PortalId, "encapsulated.provider", "XX");
            Prov = Strings.Split(objInfo.SettingValue, ",");
            handle = Activator.CreateInstance(Prov[0], Prov[1]);
            objProvider = (ChequeInterface)handle.Unwrap();
        }

        // return the provider
        public static new ChequeInterface Instance()
        {
            return objProvider;
        }

        #endregion

        public abstract void CompleteOrder(int PortalID, int OrderID, string Lang, bool UpdateStock);

    }

}